<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.intro.util.Page"%>
<%@page import="java.util.List"%>
<%@page import="com.intro.database.entity.News"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="pg"  uri="http://jsptags.com/tags/navigation/pager" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type"
			content="text/html; charset=ISO-8859-1">
		<title>Insert title here</title>
		<!-- CSS goes in the document HEAD or added to your external stylesheet -->
			<style type="text/css">
				table.gridtable {
					font-family: verdana, arial, sans-serif;
					font-size: 11px;
					color: #333333;
					border-width: 1px;
					border-color: #666666;
					border-collapse: collapse;
				}
				
				table.gridtable th {
					border-width: 1px;
					padding: 8px;
					border-style: solid;
					border-color: #666666;
					background-color: #dedede;
				}
				
				table.gridtable td {
					border-width: 1px;
					padding: 8px;
					border-style: solid;
					border-color: #666666;
					background-color: #ffffff;
				}
		</style>
	</head>
	<body>
		显示项目信息
		<s:property value="#page.totalRecords" />
		<s:property value="#request.page.totalRecords" />
		<br />
		pageEL:${ page}
		<br />

		----------------------------------
		</br>
		<s:set name="list" value="#request.page.pageList"></s:set>


		
		<table class="gridtable">
			<tr>
			    <th>图标</th>
			    <th>发表日期</th>
			    <th>内容</th>
			    <th>操作</th>
			</tr>
			
			<s:iterator var="news" value="#request.list" status="statu">
				
				<tr>
					<td><img width="250px" height="250px" src="/IntroProject/<s:property value="#news.imagePath" escape="false" />" /></td>
			    	<td><s:date name="#news.date" format="yyyy年MM月dd日"/></td>
			    	<td><s:property value="#news.content" escape="false" /></td>
			    	<td><s:a href="newsDetailAction?newsId=%{#news.id}&detailType=edit" target="_self">编辑</s:a>&nbsp;<s:a href="newsAction!newsDelete?newsId=%{#news.id}" target="_self" >删除</s:a></td>
			    </tr>
			
			</s:iterator>
		</table>
		<!-- 原来page-tiglib识别你当前访问的是哪一页是通过  ${pageUrl } 当用户访问了pageUrl 把其中的offset放到什么地方下次访问在去出来 然后判断当前页-->
		<pg:pager items="${page.totalRecords}" url="newsAction!fingAllByPage"
            export="currentPageNumber=pageNumber" maxIndexPages="5" 
            maxPageItems="${page.pageSize}">
            <pg:param name="parentorgid" />
            <pg:first>
                <a href="${pageUrl }&currentPage=1">首页</a>
            </pg:first>
            <pg:prev>
                <a href="${pageUrl }&currentPage=${pageNumber}">前一页 </a>
            </pg:prev>
            <pg:pages>
                <c:choose>
                    <c:when test="${page.currentPage eq pageNumber}">
                        <font color="red">${pageNumber}</font>
                    </c:when>
                    <c:otherwise>
                        <a href="${pageUrl }&currentPage=${pageNumber }">${pageNumber }</a>
                    </c:otherwise>
                </c:choose>
            </pg:pages>
            <pg:next>
                <a href="${pageUrl }&currentPage=${currentPageNumber+1 }">后一页</a>
            </pg:next>
            <pg:last>
                <a href="${pageUrl }&currentPage=${page.totalPages }">尾页</a>
            </pg:last>
   	 </pg:pager>
		
	</body>
</html>